<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="org.springframework.web.context.WebApplicationContext"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<h1>Available spring beans</h1>
<%
	WebApplicationContext ctx= WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext());
	try{
		for (String name:ctx.getBeanDefinitionNames())
			out.println("<li>"+name+"</li>");
		out.println(ctx.getBean("a"));
	}catch(Exception e){
		out.println("<p><b>"+e.getMessage()+"</b></p>");
	}
	try{
		out.println(ctx.getBean("aosgi"));
	}catch(Exception e){
		out.println("<p><b>"+e.getMessage()+"</b></p>");
	}
%>
</body>
</html>